package com.service.Impl;

import com.dao.CollectDao;
import com.mypg.CollectChapter;
import com.mypg.Question;
import com.service.CollectService;

import java.util.List;

public class CollectServiceImpl implements CollectService {

    private CollectDao collectDao;

    public CollectServiceImpl(){}
    public CollectServiceImpl(CollectDao collectDao) {
        this.collectDao = collectDao;
    }

    @Override
    public List<CollectChapter> selectCollectChapterByUser_id(int user_id,String question_class) {
        return collectDao.selectCollectChapterByUser_id(user_id,question_class);
    }

    @Override
    public List<Question> selectCollectQuestionByUser_id(int user_id, String question_class, String question_chapter) {
        return collectDao.selectCollectQuestionByUser_id(user_id,question_class,question_chapter);
    }

    @Override
    public int selectCountByUser_idAndQuestion_id(int user_id, int question_id) {
        return collectDao.selectCountByUser_idAndQuestion_id(user_id,question_id);
    }

    @Override
    public int selectCountByUser_id(int user_id, String question_class, String question_chapter) {
        return collectDao.selectCountByUser_id(user_id,question_class,question_chapter);
    }

    @Override
    public void collect(int user_id, int question_id) {
        collectDao.collect(user_id,question_id);
    }

    @Override
    public void cancelCollect(int user_id, int question_id) {
        collectDao.cancelCollect(user_id,question_id);
    }

    public CollectDao getCollectDao() {
        return collectDao;
    }

    public void setCollectDao(CollectDao collectDao) {
        this.collectDao = collectDao;
    }
}
